<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" href="../../plugins/layui/css/layui.css"/>
	<link rel="stylesheet" href="../../css/normalize.css"/>
	<link rel="stylesheet" href="../../css/fa.css"/>
	<link rel="stylesheet" href="../../css/icon.css"/>
	<link rel="stylesheet" href="../../css/ares_animate.min.css"/>
	<link rel="stylesheet" href="../../css/ares_hover_variant.min.css"/>
	<link rel="stylesheet" href="../../css/ares_reboot.css"/>
	<link rel="stylesheet" href="../../css/app.min.css"/>
	<link rel="stylesheet" href="../../css/iframe.css"/>
	<style>
		form input.layui-input[disabled] {
		background: #f2f2f2;
		color: #595963 !important;
		}

		#user-avatar {
		width: 100px;
		margin-top: 20px;
		cursor: pointer;
		box-shadow: 0 0 10px #44576b;
		}

		.user-address.layui-form-item .layui-input-inline {
		width: 23%;
		}

		.user-address.layui-form-item .layui-input-inline:last-child {
		margin-right: 0;
		}
	</style>
</head>
<body>
<form class="layui-form layui-row" lay-filter="userinfo-form">
	<div class="layui-col-xs12 layui-col-md6">
		<div class="layui-form-item">
			<label class="layui-form-label">用户名</label>
			<div class="layui-input-block">
				<input name="username" disabled class="layui-input layui-disabled">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">性别</label>
			<div class="layui-input-block user-sex">
				<input type="radio" name="sex" value="male" disabled title="男" checked="">
				<input type="radio" name="sex" value="female" disabled title="女">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">出生日期</label>
			<div class="layui-input-block">
				<input id="birthday" name="birthday" disabled class="layui-input layui-disabled">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">手机号码</label>
			<div class="layui-input-block">
				<input name="mobile" disabled class="layui-input layui-disabled">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">医院</label>
			<div class="layui-input-block">
				<input name="hospital" disabled class="layui-input layui-disabled">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">科室</label>
			<div class="layui-input-block">
				<input name="division" disabled class="layui-input layui-disabled">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">角色</label>
			<div class="layui-input-block">
				<input name="role" disabled class="layui-input layui-disabled">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">岗位</label>
			<div class="layui-input-block">
				<input name="job" disabled class="layui-input layui-disabled">
			</div>
		</div>
		<div class="layui-form-item group-form-item layui-hide">
			<label class="layui-form-label">分组</label>
			<div class="layui-input-block">
				<input name="group" disabled class="layui-input layui-disabled">
			</div>
		</div>


		<!--<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="update-user-info">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>-->
	</div>
</form>
<script type="text/javascript" src="../../plugins/layui/layui.js"></script>
<script type="text/javascript" src="../../aresExtends/config/layuiConfig.js"></script>
<script type="text/javascript">
    layui.use(['form','laydate','greyServices', 'mandyServices'], function (form, laydate, greyServices,mandyServices) {

		/**
		 * @author: ares
		 * @date: 2020/2/17 17:50
		 * @description: 渲染日期选择器
		 */
		laydate.render({
			elem: '#birthday'
		});

		/**
		 * @author: ares
		 * @date: 2020/2/17 17:54
		 * @description: 更新个人资料
		 */
		/*form.on("submit(update-user-info)", function (data) {
			var index = utils.layerLoadingMsg('提交中，请稍候');

			return false;
		})*/

        greyServices.grey_get_profile().then(function (res) {
			var data = res.data, job;
            if (data.job == "therapist") {
                job = '治疗师';
				$('.group-from-item').removeClass('layui-hide');
                mandyServices.mandy_get_my_treat_group_syn(function (res) {
                    form.val('userinfo-form',{group: res.data.name})
                });

            } else if (data.job == "doctor") {
                job = '医生';
            }
			form.val('userinfo-form',{
                username: data.name,
                sex: data.sex,
                birthday: data.birthday,
                mobile: data.mobile,
                hospital: data.institution.hospital.name,
                division: data.institution.division.name,
                role: data.institution.role.role,
                job: job
			})
        })
	})
</script>
</body>
</html>